<template>
  <el-dialog
    v-if="dialogVisible"
    v-model="dialogVisible"
    title="编辑新闻"
    width="80%"
    @close="handelCancel"
  >
    <div>编辑</div>

    <template #footer>
      <span class="dialog-footer">
        <el-button @click="handelCancel">取消</el-button>
        <el-button type="primary" @click="handelConfirm">确认</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script>
export default {
  name: "EditDialog",
};
</script>
<script setup>
import axios from "axios";
import { ref, watch } from "vue";

const props = defineProps({
  modelValue: Boolean,
  itemId: String,
});
const emit = defineEmits(["update:modelValue", "updateItem"]);

const dialogVisible = ref(false);

// 关闭弹窗
const handelCancel = () => {
  dialogVisible.value = false;
  emit("update:modelValue", false);
};

// 点击确定
const handelConfirm = () => {
  dialogVisible.value = false;
  emit("update:modelValue", false);
};

watch(
  () => props.modelValue,
  (newValue) => {
    dialogVisible.value = newValue;
  }
);
</script>

<style lang="scss" scoped>
</style>